<<template>
    <div>
        <div id="container"></div>
    </div>
</template>

<script>
import AMap from "AMap";
import AMapUI from "AMapUI";
export default {
  name: "Map",
  mounted() {
    this.initMap();
  },
  methods: {
    initMap() {
      this.map = new AMap.Map("container", {
        // zoom: 10,  //设置地图显示的缩放级别
        // viewMode: '2D',  //设置地图模式
        // lang:'zh_cn',  //设置地图语言类型
        zoom: 16,
        scrollWheel: false
      });
      this.positionPicker = new PositionPicker({
        mode: "dragMap",
        map: this.map
      });
      this.positionPicker.start(this.map.getBounds().getSouthwest());
      positionPicker.on("success", function(positionResult) {
        console.log(positionResult);
        this.$emit("onMoveEnd", positionResult.regeocode.pois);
        //  document.getElementById('lnglat').innerHTML=positionResult.position
        //  document.getElementById('address').innerHTML=positionResult.address
        //  document.getElementById('nearestJunction').innerHTML=positionResult.nearestJunction
        //  document.getElementById('nearestRoad').innerHTML=positionResult.nearestRoad
        //  document.getElementById('nearestPOI').innerHTML=positionResult.nearestPOI
      });
    }
  }
};
</script>

<style lang="scss" scoped>
</style>